package com.hymall.service.admin;

import com.hymall.bean.vo.*;
import com.hymall.mapper.MarketOrderGoodsMapper;
import com.hymall.mapper.MarketOrderMapper;
import com.hymall.mapper.MarketUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author: 章鹏
 * @description 统计报表
 * @date: 2022/7/17 16:20
 */
@Service
public class AdminStatServiceImpl implements AdminStatService {
    @Autowired
    MarketUserMapper marketUserMapper;

    @Autowired
    MarketOrderMapper marketOrderMapper;

    @Autowired
    MarketOrderGoodsMapper marketOrderGoodsMapper;


    /**
     * @param []
     * @return com.hymall.bean.vo.AdminStatUserVO
     * @author 章鹏
     * @description 统计报表 → 用户统计
     * @date 2022/7/17 17:48
     */
    @Override
    public AdminStatUserVO statUser() {
        AdminStatUserVO adminStatUserVO = new AdminStatUserVO();
        List<AdminStatUserInnerRowsVO> adminStatUserInnerRowsVOS = marketUserMapper.selectUserCountGroupByDay();
        adminStatUserVO.setRows(adminStatUserInnerRowsVOS);
        return adminStatUserVO;
    }

    /**
     * @param []
     * @return com.hymall.bean.vo.AdminStatOrderVO
     * @author 章鹏
     * @description 统计报表 → 订单统计
     * @date 2022/7/17 18:33
     */
    @Override
    public AdminStatOrderVO statOrder() {
        AdminStatOrderVO adminStatOrderVO = new AdminStatOrderVO();
        List<AdminStatOrderInnerRowsVO> adminStatOrderInnerRowsVOList = marketOrderMapper.selectOrderCountGroupByDay();
        adminStatOrderVO.setRows(adminStatOrderInnerRowsVOList);
        return adminStatOrderVO;
    }

    /**
     * @author 章鹏
     * @description 统计报表 → 商品统计
     * @date 2022/7/17 19:43
     * @param []
     * @return com.hymall.bean.vo.AdminStatGoodsVO
     */
    @Override
    public AdminStatGoodsVO statGoods() {
        AdminStatGoodsVO adminStatGoodsVO = new AdminStatGoodsVO();
        List<AdminStatGoodsInnerRowsVO> adminStatGoodsInnerRowsVOList = marketOrderGoodsMapper.selectGoodsCountGroupByDay();
        adminStatGoodsVO.setRows(adminStatGoodsInnerRowsVOList);
        return adminStatGoodsVO;
    }


}
